home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7340 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  41 lines

  1. Newsgroups: comp.lang.c
  2. Path: uu4news.netcom.com!zodiac!szh
  3. From: szh@zcon.com (Syed Zaeem Hosain)
  4. Subject: Re: Binary files ? 
  5. Message-ID: <1996Feb25.165110.7858@zcon.com>
  6. Sender: szh@zcon.com (Syed Zaeem Hosain)
  7. Nntp-Posting-Host: zodiac
  8. Reply-To: szh@zcon.com
  9. Organization: Z Consulting Group
  10. References: <Pine.SV4.3.91-heb-2.04.960224055809.17461A-100000@cs.technion.ac.il>
  11. Date: Sun, 25 Feb 1996 16:51:10 GMT
  12.  
  13. In article <Pine.SV4.3.91-heb-2.04.960224055809.17461A-100000@cs.technion.ac.il>, Kohn Emil Dan <emild@cs.technion.ac.il> writes:
  14. >Just open the file using  "rb" for reading and "wb" for writing, (instead 
  15. >of "r", and "w" respectively, and everything will be ok. 
  16. >
  17. >In UNIX, there is no difference between text and binary files, a file is 
  18. >a stream of bytes. In DOS, the situation is much stranger, I think he 
  19. >expands \n to \n\r, and puts an EOF (CTRL-Z) at the end of file, when a 
  20. >file is opened in text mode.
  21.  
  22. There is no *automatic* insertion of a control-Z byte at the end of the
  23. file when it is opened and closed in text mode in DOS. This is up to you
  24. to do *if* you want to, but it is not necessary or required by DOS.
  25.  
  26. Also, for what it is worth, the definition of EOF in C (found in stdio.h)
  27. is not CTRL-Z.
  28.  
  29. >And last, but not least: main() returns int, not void...
  30.  
  31. Yes!
  32.  
  33.                                 Z
  34.  
  35.  
  36. -- 
  37. -------------------------------------------------------------------------
  38. | Syed Zaeem Hosain          P. O. Box 610097            (408) 441-7021 |
  39. | Z Consulting Group        San Jose, CA 95161             szh@zcon.com |
  40. -------------------------------------------------------------------------
  41.